home *** CD-ROM | disk | FTP | other *** search
/ Power Bytes: Money & Finance / PowerBytes Money and Finance CD-ROM 01 / PowerBytes Money and Finance CD-ROM 01.iso / HyperCard Files / Check Stuff / CheckWriter / Check Register / card_5803.txt < prev    next >
Encoding:
Text File  |  1988-04-19  |  7.1 KB  |  277 lines

  1. -- card: 5803 from stack: in
  2. -- bmap block id: 6514
  3. -- flags: 0000
  4. -- background id: 3854
  5. -- name: Balance
  6. ----- HyperTalk script -----
  7. on openCard
  8.   tabKey
  9. end openCard
  10.  
  11. on balance
  12.   global FirstRow,NbrCols,LastRow,PayCol,DepCol,BalCol
  13.   set cursor to 4
  14.   put "Last balanced" & return & the abbrev date into card field "Last Balanced"
  15.   set numberFormat to "0.00"
  16.   put 4 into XCol
  17.   put empty into card field "Checks Out"
  18.   put empty into card field "Deps Out"
  19.   put zero into card field "Total Deps"
  20.   put zero into card field "Total Checks"
  21.   get card field "Balance" of first card
  22.   delete first char of it -- Get rid of "$".
  23.   put it into card field "Book Balance Is"
  24.   put empty into card field "Book Balance SB"
  25.   put empty into card field "Error"
  26.   repeat with j = (the number of first card of bkgnd "CheckReg") to (the number of last card of bkgnd "CheckReg")
  27.     put FirstRow into i
  28.     set lockMessages to true
  29.     repeat
  30.       if i > LastRow then exit repeat
  31.       set lockScreen to true
  32.       go to card j
  33.       if field (i + XCol) is empty then
  34.         get field (i + DepCol)
  35.         if it is not empty then
  36.           put field (i + 1) into dat
  37.           if length(dat) < 12 then put space before char 8 of dat
  38.           put right(field i,5) && dat && left(first line of field (i + 2),35) && right(it,9) & return into linex
  39.           go to card "Balance"
  40.           set lockScreen to false
  41.           put (((the number of lines in card field "Deps Out") + 1) * (the textHeight of card field "Deps Out") + 8) - ((item 4 of the rect of card field "Deps Out") - (item 2 of the rect of card field "Deps Out")) into scrollx
  42.           if scrollx < 0 then put 0 into scrollx
  43.           set scroll of card field "Deps out" to scrollx
  44.           put linex after card field "Deps Out"
  45.           add it to card field "Total Deps"
  46.           set lockScreen to true
  47.           go to card j
  48.         end if
  49.         get field (i + PayCol)
  50.         if it is not empty then
  51.           put field (i + 1) into dat
  52.           if length(dat) < 12 then put space before char 8 of dat
  53.           put right(field i,5) && dat && left(first line of field (i + 2) ,35) && right(it,9) & return into linex
  54.           go to card "Balance"
  55.           set lockScreen to false
  56.           put (((the number of lines in card field "Checks Out") + 1) * (the textHeight of card field "Checks Out") + 8) - ((item 4 of the rect of card field "Checks Out") - (item 2 of the rect of card field "Checks Out")) into scrollx
  57.           if scrollx < 0 then put 0 into scrollx
  58.           set scroll of card field "Checks out" to scrollx
  59.           put linex after card field "Checks Out"
  60.           add it to card field "Total Checks"
  61.           --set lockScreen to true
  62.           --go to card j
  63.         end if
  64.       end if
  65.       go to card "Balance"
  66.       set lockScreen to false
  67.       add NbrCols to i
  68.     end repeat
  69.     set lockMessages to false
  70.   end repeat
  71.   totals
  72. end balance
  73.  
  74. on totals
  75.   set numberFormat to "0.00"
  76.   get card field "Stmt Balance"
  77.   if it is empty then get zero
  78.   add (card field "Total Deps") - (card field "Total Checks") to it
  79.   put it into card field "Book Balance SB"
  80.   get it - (card field "Book Balance Is")
  81.   if it is zero then get "** Zero **"
  82.   else if first char of it is not "-" then put "+" before it
  83.   put it into card field "Error"
  84. end totals
  85.  
  86. function left s,n,c
  87. if c is empty then put space into c
  88. repeat
  89.   if length(s) >= n then exit repeat
  90.   put c after s
  91. end repeat
  92. return char 1 to n of s
  93. end left
  94.  
  95. function right s,n,c
  96. if c is empty then put space into c
  97. repeat
  98.   if length(s) >= n then exit repeat
  99.   put c before s
  100. end repeat
  101. return char length(s) - n + 1 to length(s) of s
  102. end right
  103.  
  104.  
  105.  
  106.  
  107. -- part 1 (field)
  108. -- low flags: 01
  109. -- high flags: 2007
  110. -- rect: left=13 top=59 right=135 bottom=497
  111. -- title width / last selected line: 0
  112. -- icon id / first selected line: 0 / 0
  113. -- text alignment: 0
  114. -- font id: 4
  115. -- text size: 12
  116. -- style flags: 0
  117. -- line height: 16
  118. -- part name: Checks Out
  119.  
  120.  
  121. -- part 2 (field)
  122. -- low flags: 01
  123. -- high flags: 2007
  124. -- rect: left=13 top=157 right=233 bottom=497
  125. -- title width / last selected line: 0
  126. -- icon id / first selected line: 0 / 0
  127. -- text alignment: 0
  128. -- font id: 4
  129. -- text size: 12
  130. -- style flags: 0
  131. -- line height: 16
  132. -- part name: Deps Out
  133.  
  134.  
  135. -- part 3 (field)
  136. -- low flags: 01
  137. -- high flags: 0002
  138. -- rect: left=350 top=134 right=153 bottom=477
  139. -- title width / last selected line: 0
  140. -- icon id / first selected line: 0 / 0
  141. -- text alignment: 65535
  142. -- font id: 4
  143. -- text size: 12
  144. -- style flags: 256
  145. -- line height: 16
  146. -- part name: Total Checks
  147.  
  148.  
  149. -- part 4 (field)
  150. -- low flags: 01
  151. -- high flags: 0002
  152. -- rect: left=350 top=232 right=251 bottom=477
  153. -- title width / last selected line: 0
  154. -- icon id / first selected line: 0 / 0
  155. -- text alignment: 65535
  156. -- font id: 4
  157. -- text size: 12
  158. -- style flags: 256
  159. -- line height: 16
  160. -- part name: Total Deps
  161.  
  162.  
  163. -- part 5 (field)
  164. -- low flags: 01
  165. -- high flags: 0000
  166. -- rect: left=240 top=261 right=280 bottom=332
  167. -- title width / last selected line: 0
  168. -- icon id / first selected line: 0 / 0
  169. -- text alignment: 65535
  170. -- font id: 4
  171. -- text size: 12
  172. -- style flags: 256
  173. -- line height: 16
  174. -- part name: Book Balance Is
  175.  
  176.  
  177. -- part 6 (field)
  178. -- low flags: 00
  179. -- high flags: 0002
  180. -- rect: left=240 top=244 right=263 bottom=332
  181. -- title width / last selected line: 0
  182. -- icon id / first selected line: 0 / 0
  183. -- text alignment: 65535
  184. -- font id: 4
  185. -- text size: 12
  186. -- style flags: 256
  187. -- line height: 16
  188. -- part name: Stmt Balance
  189. ----- HyperTalk script -----
  190. on closeField
  191.   totals
  192. end closeField
  193.  
  194.  
  195.  
  196. -- part 7 (button)
  197. -- low flags: 00
  198. -- high flags: 2000
  199. -- rect: left=454 top=295 right=317 bottom=490
  200. -- title width / last selected line: 0
  201. -- icon id / first selected line: 6720 / 6720
  202. -- text alignment: 1
  203. -- font id: 0
  204. -- text size: 12
  205. -- style flags: 0
  206. -- line height: 16
  207. -- part name: Return
  208. ----- HyperTalk script -----
  209. on mouseUp
  210.   visual effect iris close
  211.   go to first card
  212. end mouseUp
  213.  
  214.  
  215.  
  216. -- part 8 (button)
  217. -- low flags: 00
  218. -- high flags: 8003
  219. -- rect: left=365 top=261 right=283 bottom=495
  220. -- title width / last selected line: 0
  221. -- icon id / first selected line: 0 / 0
  222. -- text alignment: 1
  223. -- font id: 0
  224. -- text size: 12
  225. -- style flags: 0
  226. -- line height: 16
  227. -- part name: Compute Balance
  228. ----- HyperTalk script -----
  229. on mouseUp
  230.   set hilite of the target to true
  231.   balance
  232.   set hilite of the target to false
  233. end mouseUp
  234.  
  235.  
  236.  
  237. -- part 9 (field)
  238. -- low flags: 01
  239. -- high flags: 0000
  240. -- rect: left=240 top=279 right=298 bottom=332
  241. -- title width / last selected line: 0
  242. -- icon id / first selected line: 0 / 0
  243. -- text alignment: 65535
  244. -- font id: 4
  245. -- text size: 12
  246. -- style flags: 256
  247. -- line height: 16
  248. -- part name: Book Balance SB
  249.  
  250.  
  251. -- part 10 (field)
  252. -- low flags: 01
  253. -- high flags: 0000
  254. -- rect: left=240 top=297 right=316 bottom=332
  255. -- title width / last selected line: 0
  256. -- icon id / first selected line: 0 / 0
  257. -- text alignment: 65535
  258. -- font id: 4
  259. -- text size: 12
  260. -- style flags: 256
  261. -- line height: 16
  262. -- part name: Error
  263.  
  264.  
  265. -- part 11 (field)
  266. -- low flags: 01
  267. -- high flags: 0000
  268. -- rect: left=338 top=31 right=59 bottom=499
  269. -- title width / last selected line: 0
  270. -- icon id / first selected line: 0 / 0
  271. -- text alignment: 1
  272. -- font id: 3
  273. -- text size: 9
  274. -- style flags: 0
  275. -- line height: 12
  276. -- part name: Last Balanced
  277.